#include<stdio.h>
#include<iostream>
#include<string.h>
using namespace std;
int Sum(int n)
{
	if (!n)return 1;
	int sum = 0;
	for (int i = 1; i < n; i++)if (n%i == 0)sum += i;
	return sum;
}
int main()
{
	int n,num;
	cin >> n;
	while (n--)
	{
		cin >> num;
		cout << Sum(num) << endl;
	}
	return 0;
}